/**
 *
 * 开始学习词汇处理
 *
 */
package com.ilovetolearn.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.ilovetolearn.model.ModelLocator;
	import com.ilovetolearn.vo.WordVo;

	public class StudyWordCommand implements ICommand
	{
		private var _model:ModelLocator=ModelLocator.getInstance();

		public function StudyWordCommand()
		{
		}

		public function execute(event:CairngormEvent):void
		{
			for (var i:Number=0; i < _model.wordAc.length; i++)
			{
				var obj:WordVo=_model.wordAc.getItemAt(i) as WordVo;
				if (obj.ischecked == false)
				{
					_model.wordAc.removeItemAt(i);
				}
			}
			_model.wordAc.refresh();
			trace("length:" + _model.wordAc.length);
			if (_model.wordAc.length > 0)
			{
				_model.curStudyWord=_model.wordAc.getItemAt(_model.curStudyIndex) as WordVo;
			}
			_model.curState="WordStudyState";
		}
	}
}